1. Field of the Invention
The present invention relates to printed codes and, more particularly, to codes for use on print media to identify properties of such media.
2. Related Art
Conventional digital printers print on print media having a wide variety of properties. Examples of properties which may vary among different print media include dimensions, manufacturer, chemical composition, and sensitivity. Often it is useful for the printer to take into account the particular properties of the current print medium when printing, so that the printer may optimize the quality of the print output based on such properties.
Although the user of the printer may manually inform the printer of the current print medium properties (such as by selecting settings on a hardware control panel or through a software configuration program), various techniques are well-known for encoding information descriptive of such properties on the print medium itself. For example, such information (referred to herein as “print medium property information”) may be encoded in a code printed on the medium, in magnetic material incorporated into the medium, or in a chemical substrate on the medium. In such systems the printer is equipped with a device that reads the encoded information from the print medium. The printer decodes the information to identify the properties of the print medium. The printer may then take appropriate steps to optimize the print output based on the identified properties of the print medium.
For example, in some systems the print medium property information is encoded in a bar code that is printed on the medium. The corresponding printer includes a bar code reader that reads the bar code from the print medium as the bar code passes underneath the reader.
Before describing such conventional systems further, conventional bar codes will be explained in more detail. In general, a bar code is an arrangement of dark bars and spaces that is used to encode information. Such information typically relates to a particular product, and typically is printed on the product or the product's packaging. Many different systems exist for encoding information in bar codes. The term “bar code system” refers herein to any particular system for representing information using bar codes. The Universal Product Code (UPC), which is printed nearly-universally on product packaging, is perhaps the best-known example of a bar code system.
Referring to FIG. 1, a generic example of a conventional bar code 100 is shown. The bar code 100 includes a sequence of vertical black bars (“bars”) 102a-i of various widths separated by white spaces (“spaces”) 104a-h of various widths. The term “feature” refers herein to either a single bar or a single space in a bar code. Therefore, each of the bars 102a-i and each of the spaces 104a-h is a feature.
Each feature in a bar code typically is significantly taller than it is wide. The term “feature width” refers herein to the width of a single feature in the dimension 106a that connects the centers of all of the features (e.g., bars). Typically, a bar code system imposes a minimum feature width (such as 7.5 mils) on all features in bar codes in the system. The minimum feature width is referred to herein as a “unit.” Different features in a single bar code may have different widths. For example, feature 102e is twice as wide as feature 102d. If the width of feature 102d is the minimum feature width, then feature 102d may be said to be a “single width” or “narrow” feature, while feature 102e may be said to be a “double width” or “wide” feature.
Many bar code systems require the width of each feature to be an integral multiple of the minimum feature width. For example, in the example bar code 100 illustrated in FIG. 1, the width of each feature is either equal to the minimum feature width or exactly twice the minimum feature width. Not all systems, however, require all feature widths to be integral multiples of the minimum feature (unit) width. In bar codes with only two distinct widths, wide features typically are between 2 and 2.5 times as wide as narrow features. In general, feature widths within a single bar code may vary in any way so long as the features can be consistently decoded correctly.
The term “combination” refers herein to a specific, unique ordering of a limited number of features using a given width distribution. The term “width distribution” will be defined below. The bar code 100 illustrated in FIG. 1 is an example of a combination. The term “symbol,” as used herein, is synonymous with “combination.”
Typically, a bar code system defines a mapping between a set of combinations and corresponding values, such as characters and/or numbers. Such a mapping may be used to encode the values into their corresponding combinations and to decode the combinations into their corresponding values. A bar code system typically imposes a set of restrictions on symbols within the system, such as a fixed symbol length (measured in units), a fixed number of features, or both. The “symbol set” of a bar code system refers to all symbols defined in the bar code system. Typically the symbol set includes all possible symbols that satisfy the applicable set of restrictions, such as symbol length.
The term “bar code” typically refers to a sequence of one or more symbols that are members of the same symbol set (i.e., that are defined according to a single bar code system). The term “start code” refers to a special sequence of features that is not a member of the symbol set, and that defines the start of a bar code. The start code that occurs at the beginning of a particular bar code sequence identifies the bar code system and any special coding features that the bar code may contain. Similarly, the term “stop code” refers to a special sequence of features that is not a member of the symbol set, and that defines the end of a bar code. A conventional bar code, therefore, typically includes a start code, followed by one or more symbols, followed by a stop code. The start code and stop code enable the bar code decoder to scan the bar code in the correct direction and use the correct decoding method.
As described above, a bar code symbol includes a sequence of features that may differ from each other in width. In some bar code systems, however, each symbol is restricted to include a fixed number of features having a fixed number of predefined widths. For example, a bar code system may require each symbol to include four features of a single width, three features of double width, and one feature of triple width, for a total of eight features having a total width of thirteen units. This “width distribution” may be expressed using the notation (4,3,1). In such systems, all symbols have the same width distribution but vary by the order in which features of different widths appear.
A “width array” is an array which represents the sequence of feature widths in a particular bar code symbol. For example, when using the width distribution just noted, an example of a valid width array is (1,2,1,1,3,2,2,1). This width array represents a symbol in which the first feature is single-width, the second feature is double-width, the third feature is single-width, the fourth feature is single-width, and so on. As used herein, the variable N refers to the number of features in a symbol, and the variable Wf refers to the width of the feature at index f in the symbol, where 1≦f≦N. In the case of the example width array just provided, W1=1, W2=2, and W5=3.
Different bar code systems have different “information densities.” The term “information density” refers herein to the effective number of bits per unit that a particular bar code system is capable of encoding, and may be defined as log2(total number of available symbols)/(length of a symbol expressed in “units”). For example, in a “2 of 5” bar code system, each symbol has exactly five features, exactly two of which are wide and exactly three of which are narrow (i.e., the width distribution is (3,2)). An example of a 2 of 5 symbol is BWSNBNSWBN, where “B” refers to a bar, “S” refers to a space, the subscript “W” refers to a wide feature, and the subscript “N” refers to a narrow feature.
There are 10 possible symbols in the 2 of 5 system, effectively representing 3.3 bits of information. There are 7 units in each symbol (3 narrow features of one unit each, plus 2 wide features of two units each). Therefore the information density of the 2 of 5 system is 3.3 bits/7 units, or approximately 0.47 bits per unit. This information density is relatively high among existing bar code systems. It is desirable to achieve higher information densities in situations in which a large amount of information must be encoded in a small bar code.
A bar code system would not be useful if it were not possible to encode information into a bar code and to decode information from a bar code. Therefore, for any particular bar code system it is necessary to provide methods for encoding and decoding information to and from bar codes. Typically, encoding is performed using a lookup table which maps unencoded information (such as numbers) into bar codes in the system. Similarly, decoding typically is performed using a lookup table that maps bar codes into numerical information or other kinds of values. Although encoding and decoding may be performed quickly using lookup tables, one disadvantage of lookup tables is that their storage may consume significant amounts of memory, particularly in bar code systems in which symbols contain a large number of features. In general, it is desirable to perform encoding and decoding both quickly and using a relatively small amount of memory.
Therefore, what is needed are improved techniques for efficiently encoding and decoding media-identifying information in bar codes.